<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>修改密码</title>
<script type="text/javascript" src="${ctx }/js/bootstrap/jquery.js"></script>
<script type="text/javascript">

function back(){
	window.location.href="${ctx }/knowedge/type/manager";
	closeWin();
}


//判断
function getOldPwd(){
	$.ajax({
		url:"${ctx}/user/passWordOldSame",
		type:"POST",
		dataType:"json",
		async:false,  
		data:"oldPassword="+$("#oldPassword").val(),
		success:function(data){
			if(!data){
				$('#oldPassword').validationEngine('showPrompt','原密码输入不正确!','error');
			}
		}
	});
}

function sub(){
	if($("#mainForm").validationEngine('validate')){
		$("#mainForm").ajaxSubmit({
	        type: "post",
	        dataType: "text",
	        success: function(data){
	        	if(data == 'true'){
	        		art.dialog({content:"密码修改成功!",
	        			ok:function(){
	        				parent.window.location.href="${ctx }/login/logout";
	        				closeWin();
	        			}
	        		});
	        	}else if(data =='noSame'){
	        		$('#oldPassword').validationEngine('showPrompt','原密码输入不正确!','error');
	        	}else{
	        		art.dialog({content:"密码修改失败，请检查！",ok:true});
	        	}
	        }
	    });
	}
}

function closeWin(){
	art.dialog.close();
}

</script>
</head>
<body style="width: 90%">
	<form id="mainForm" name="mainForm" class="form-horizontal"
		action="${ctx }/user/updatePwdWord" method="post">
		<div class="page-content">
			<div class="row" style="margin-top: 40px;">
				<div class="col-xs-12">
					<div class="form-group" id="bonusPriceDiv">
						<label for="inputEmail3" class="col-sm-4 control-label"> <b
							class="red">*</b><strong>原密码</strong></label>
						<div class="col-sm-4">
							<input type="password"
								class="form-control validate[required,minSize[6],maxSize[18]]"
								id="oldPassword" maxlength="18" name="oldPassword" value="">
						</div>
					</div>
					<div class="form-group" id="bonusPriceDiv">
						<label for="inputEmail3" class="col-sm-4 control-label"> <b
							class="red">*</b><strong>新密码</strong></label>
						<div class="col-sm-4">
							<input type="password"
								class="form-control validate[required,custom[onlyLetterNumber2],minSize[6],maxSize[18]]"
								id="password" name="password" maxlength="18" name="name"
								value="">
						</div>
					</div>
					<div class="form-group" id="bonusPriceDiv">
						<label for="inputEmail3" class="col-sm-4 control-label"> <b
							class="red">*</b><strong>确认密码</strong></label>
						<div class="col-sm-4">
							<input type="password"
								class="form-control validate[required,minSize[6],maxSize[18],equals[password]]"
								id="confirmPassword" maxlength="18" name="confirmPassword"
								value="">
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-8"
							style="text-align: center; margin-top: 20px;">
							<button type="button" onclick="sub();" class="btn btn-info">提交</button>
							<button type="button" onclick="back();" class="btn btn-default">取消</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</form>

</body>
</html>